package beans;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.servlet.http.HttpServletRequest;

@Entity
@Table(name = "historique")
@NamedNativeQuery(name = "getHistorique", query = "select * from historique where clientID=?", resultClass = HistoriqueFields.class)
public class HistoriqueFields implements Serializable {

    @Transient
    private static final String ATT_USER_NAME   = "userName";
    @Transient
    private static final String ATT_CLIENT_INFO_ID ="Client_info_id";
    
    @Id
    @GeneratedValue( strategy = GenerationType.AUTO )
    private long                id;
    private long                clientID;
    private String              userName;
    private String              fieldName;
    private String              oldValue;
    private String              newValue;
    private Date                fieldChangeDate;
    
    public HistoriqueFields()
    {
        
    }
    
    public HistoriqueFields(long clientID,  String userName, String fieldName, String oldValue, String newValue) {
        
        
        this.setClientID( clientID );
        this.userName = userName;
        this.fieldName = fieldName;
        this.oldValue = oldValue;
        this.newValue = newValue;
        this.fieldChangeDate = new Date();

    }
    
    
    public Date getFieldChangeDate() {
        return fieldChangeDate;
    }

    public void setFieldChangeDate( Date fieldChangeDate ) {
        this.fieldChangeDate = fieldChangeDate;
    }

    public long getId() {
        return id;
    }
    public void setId( long id ) {
        this.id = id;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName( String userName ) {
        this.userName = userName;
    }
    public String getFieldName() {
        return fieldName;
    }
    public void setFieldName( String fieldName ) {
        this.fieldName = fieldName;
    }
    public String getOldValue() {
        return oldValue;
    }
    public void setOldValue( String oldValue ) {
        this.oldValue = oldValue;
    }
    public String getNewValue() {
        return newValue;
    }
    public void setNewValue( String newValue ) {
        this.newValue = newValue;
    }
    
    

    public long getClientID() {
        return clientID;
    }

    public void setClientID( long clientID ) {
        this.clientID = clientID;
    }
    

}
